package com.example.lawyer;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;

import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;

import com.example.lawyer.databinding.ActivityMainBinding;
import com.example.lawyer.databind.activity.ActivityMainDatabindModel;
import com.example.lawyer.interfacecallback.ActivityMainDatabindCallback;
import com.example.lawyer.interfaceservice.ActivityMainDatabindService;

public class MainActivity extends AppCompatActivity implements ActivityMainDatabindCallback {

    private ActivityMainBinding activityMainBinding;
    private ActivityMainDatabindModel databindModel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        activityMainBinding = DataBindingUtil.setContentView(this,R.layout.activity_main);
        databindModel = new ActivityMainDatabindModel();
        activityMainBinding.setMaindatabinding(databindModel);
        ActivityMainDatabindService activityMainDatabindService = new ActivityMainDatabindService(this);
        activityMainDatabindService.GetConverUrl();
        activityMainBinding.setMaindatabinding(databindModel);
        HideStateWindow();

    }


    private void HideStateWindow()
    {
        WindowManager.LayoutParams attrs = getWindow().getAttributes();
        attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
        getWindow().setAttributes(attrs);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);////设置固定状态栏常驻，覆盖app布局
            getWindow().setStatusBarColor(Color.parseColor("#80000000"));//设置状态栏颜色
        }
    }


    @Override
    public void OnCoverDataResult(String url) {
        databindModel.url.set(url);
        JumpSik();
    }

    //跳转
    private void JumpSik()
    {
        Intent intent = new Intent();
        intent.setAction("home");
        startActivity(intent);

    }

}

